#pragma once

class CSglDoc;

class CSglTree : public CTreeView
{

public:

	virtual ~CSglTree();

	CSglDoc* GetDocument(VOID);

	VOID SelectSubFile(UINT nSubIdx);
	VOID SelectFrame(UINT nImageIdx, UINT nFrameIdx);

protected:

	friend class CSglTreeItem;

	CSglTree();
	DECLARE_DYNCREATE(CSglTree)

	VOID GetIconIndex(PSGLSUB pSub, INT &nImage, INT &nSelectImg);
	VOID GetIconIndex(PSGLFRM pFrame, INT &nImage, INT &nSelectImg);

	HTREEITEM LookupItem(UINT nSubIdx);
	HTREEITEM LookupItem(UINT nImageIdx, UINT nFrameIdx);

	HTREEITEM OpenItem(UINT nSubIdx);
	HTREEITEM OpenItem(UINT nImageIdx, UINT nFrameIdx);

	virtual BOOL PreCreateWindow(CREATESTRUCT& cs);

	virtual void OnInitialUpdate(VOID);
	virtual void OnUpdate(CView *pSender, LPARAM lHint, CObject *pHint);

	afx_msg void OnTvnItemexpanding(NMHDR *pNMHDR, LRESULT *pResult);
	afx_msg void OnTvnSelchanged(NMHDR *pNMHDR, LRESULT *pResult);
	afx_msg void OnTvnDeleteitem(NMHDR *pNMHDR, LRESULT *pResult);

	DECLARE_MESSAGE_MAP()

};
